(1) Field of the Invention
This invention relates generally to image processing and relates more particularly to a method and an algorithm to compensate lens shading or vignetting in digital images.
(2) Description of the Prior Art
Photographically, vignetting means the darkening of the corners relative to the centre of an image. All camera lenses suffer, more or less, of these optical phenomena.
FIG. 1 prior art describes some major steps performed in image processing. In the first step 10 a raw image is obtained. In the next step 11 the offset/gain calibration is performed, followed by the compensation for vignetting 12. The last step 13 is the color processing.
A simple lens obeys an optical law called the “cos-4th law” (cosine of the angle of incidence off the lens axis to the 4th power. The cos-4th influence comes from a number of factors, including that the light gets spread out over a larger area, and that the corners of the image are further away from the center of the lens than the on-axis part of the image. This means that for a lens with an angle of view of 20 degrees, where the maximum off-axis angle of incidence is 10 degrees, the corners receive cos (10 degrees) to the 4th power as much light as the center. Cos (10 degrees) is 0.9848, so to the 4th power is 0.9406. Therefore the corners get 94 percent as much light as the center, a generally imperceptible difference. A 20-degree angle of view for a 35 mm camera equates to a 123 mm lens. For a 28 mm lens, with a 75-degree angle of view, cos 4th comes to 0.39. So now the corners only get 39 percent of the light that the center gets. For a 20 mm lens this goes down to 21 percent, and for a 15 mm lens this goes down to 10.5 percent. Obviously the last case is unworkable and is not acceptable.
In order to solve said problems with lens shading, cameras are using typically complex optical systems, which are very expensive to manufacture. It is a challenge for the designers of digital cameras to design a camera having very low vignetting using less expensive lenses.
A compensation of lens shading is performed using a correction factor, which is dependent upon the distance of the pixel from the center of the lens. FIG. 2a prior art shows a top view of a lens/sensor system comprising a lens 21 and a sensor 20. The center 22 of the lens 20, which is also the center of the sensor, has the coordinates Xcenter, Ycenter. A pixel 23 of the sensor 20 has the coordinates x, y. FIG. 2b prior art shows a side view of said lens/sensor system comprising said lens 21 and sensor 20. Light ray traces 25 emanating from an object 24 are reunited at the pixel 23 of the sensor.
The distance of the pixel 23 having the coordinates x, y from the center 22, having the coordinates Xcenter, Ycenter, can be calculated using the equation:
                    dist        =                                                                              (                                      x                    -                                          x                      center                                                        )                                2                            -                                                (                                      y                    -                                          y                      center                                                        )                                2                                              .                                    (        1        )            
An algorithm to compensate lens shading ispixelnew=pixelold×fcorr,wherein the prior art correction factor fcorr is calculated using the equation
                                          f            corr                    =                      1            +                                          f                c                            ×                              (                                  1                  -                                                            cos                      ⁡                                              (                                                  dist                                                      d                            f                                                                          )                                                              4                                                  )                                                    ,                            (        2        )            wherein the distance dist has been calculated using equation (1) above and the constant factors fc and df are dependent upon the geometry of the sensor system and the lens used. It is obvious that the correction factor according to equation (2) is difficult to calculate and algorithms, which are easier to be calculated, are very desirable.
The U.S. patent application Ser. No. 10/379,863, filed on Mar. 4, 2003, and assigned to the same assignee as the present invention describes a different method to compensate lens shading or vignetting in digital cameras. The compensation for vignetting is done in two steps. The first step is done during production of the camera unit and involves taking and analyzing an image of a test screen, preferably a gray test screen. This results in a set of e.g. 5×5 coefficients describing a polynomial surface. The second step is done for each image that is taken by the camera and involves calculating and applying a gain-table based on polynomial coefficients to all pixels of the image to compensate vignetting.
Other solutions dealing with the suppression of lens shading are described in the following patents:
U.S. Pat. No. (6,388,706 to Takizawa et al.) describes an image processing method for an electronic camera which includes a photoelectric element having plural sensors and color filters in plural different colors, wherein each of the plural sensors corresponds to a respective one of the color filters in the different colors. The method includes the steps of: obtaining a signal value from a target sensor; obtaining the first average value from signal values of the sensors; obtaining the second average value from signal values of the sensors and obtaining an interpolation value for a color, which is different from that of the color filter of the target sensor, of the target sensor according to the signal value from the target sensor, the first average value and the second average value. The vignetting of a lens causes a decrease in marginal brightness of an image field. However, if the correction for the decrease in marginal brightness is performed at the same time of performing white balance adjustment or/and gain adjustment, the correction for the marginal brightness may be performed upon decreasing the calculation volume.
U.S. Pat. No. (6,323,934 to Enomoto) discloses an image processing method in which at least one aberration of an optically recorded image selected from among lateral chromatic aberration, distortion, decrease on the brightness of the edge of image field and image blurring is corrected based on lens characteristics of a taking lens and position information of the image. Additionally, an image processing apparatus comprises an acquiring section for acquiring information identifying a taking lens; a storage section for storing lens characteristics associated with the type of the taking lens; and a correction section which receives the corresponding lens characteristics of the taking lens from the storage section and corrects at least one aberration selected from among lateral chromatic aberration, distortion, vignetting and image blurring. High-quality images that are free from color mismatch, distortion, uneven brightness, blurring and other defects, or both vignetting and distortion can be outputted consistently.